﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using System.Web.Routing;
using Kusog.Mvc;

namespace SharepointPlugin
{
    [Export(typeof(Kusog.Mvc.IMvcPlugin))]
    [MvcPluginMetadata("ksgSharepoint", null, "Sharepoint Plugin", "Work easily with sharepoint data.")]
    public class SharepointPlugin : BaseMvcPlugin
    {
        public override void SetupExtensions(IMvcPluginApplication app)
        {
            base.SetupExtensions(app);
            RegisterWidget(new Widget("SharepointArticles", "Sharepoint Article List", "Sharepoint", "ArticleList"));
            RegisterWidget(new Widget("SharepointArticle", "Sharepoint Article", "Sharepoint", "Article"));
            RegisterWidget(new Widget("SharepointListItems", "Sharepoint List Items", "Sharepoint", "ListItems"));
            RegisterRoute("SharepointDocs", "Shared Documents/{*fileName}", new { controller = "Sharepoint", action = "Documents" });
            RegisterRoute("SharepointListItem", "spd/{listName}/{id}", new { controller = "Sharepoint", action = "ListItem" });
        }
    }
}
